<template>
    <div>
        <br>
        获取到的token：{{token}}
        <br>
        获取到的uid：{{uid}}
        <br>
        <br>
        <br>
        <br>
        <button @click="shouquan">点击授权</button>
        <br>
        <br>
        <br>
        <div v-show="show">
            <van-field label="手机号" v-model="mobile"/>
            <van-field label="密码" v-model="password" />
            <van-button @click="add">提交</van-button>
        </div>

    </div>
</template>

<script>
    export default {
        data() {
            return {
                token:'',
                uid:'',
                show : 0 ,
                mobile:'',
                password:''
            }
        },
        methods: {
            shouquan(){
                this.$axios.post('/shouquan/',{'token':this.token,'uid':this.uid}).then(res=>{
                    if(res.data.code == 20020){
                        alert(res.data.mas)
                        this.show = 1
                    }else if(res.data.code == 200){
                        alert(res.data.mas)
                    }
                    
                })
            },
            add(){
                this.$axios.get('/shouquan/?mobile='+this.mobile+'&password='+this.password+'&uid='+this.uid+'&token='+this.token).then(res=>{
                    alert('绑定成功现在 正在跳转回主页面')
                    
                })
            }
        },
        mounted() {
            this.$axios.get('/sflogin/').then(res=>{
                    this.token = res.data.token 
                    this.uid = res.data.uid
                    
                })
        },
    }
</script>

<style scoped>

</style>